package com.qf.controller;

import com.qf.dto.R;
import com.qf.dto.UserDto;
import com.qf.pojo.Users;
import com.qf.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UsersController {
    private UsersService usersService;
    @Autowired
    public void setUsersService(UsersService usersService) {
        this.usersService = usersService;
    }

    @PostMapping("/newuser")
    public R newcategory(@RequestBody UserDto userDto){

        usersService.insertUsers(userDto);
        return R.setOk(null);
    }

    @PostMapping("/login")
    public R login(@RequestBody Users users){

        usersService.login(users);
        return R.setOk(users);
    }

}
